<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>lwIP: src/include/lwip/ip4_addr.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">lwIP
   &#160;<span id="projectnumber">2.1.2</span>
   </div>
   <div id="projectbrief">Lightweight IP stack</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('ip4__addr_8h.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">ip4_addr.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="opt_8h.html">lwip/opt.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="def_8h.html">lwip/def.h</a>&quot;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structip4__addr.html">ip4_addr</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:abc4b2e3531c4992f2ae4b8c0f9751544"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#abc4b2e3531c4992f2ae4b8c0f9751544">IPADDR_NONE</a>&#160;&#160;&#160;((u32_t)0xffffffffUL)</td></tr>
<tr class="separator:abc4b2e3531c4992f2ae4b8c0f9751544"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6f51a2eb21547df4e6b3ba046188345e"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#a6f51a2eb21547df4e6b3ba046188345e">IPADDR_LOOPBACK</a>&#160;&#160;&#160;((u32_t)0x7f000001UL)</td></tr>
<tr class="separator:a6f51a2eb21547df4e6b3ba046188345e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad6ed0d622d61ecd6edd606e3b564f0a2"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#ad6ed0d622d61ecd6edd606e3b564f0a2">IPADDR_ANY</a>&#160;&#160;&#160;((u32_t)0x00000000UL)</td></tr>
<tr class="separator:ad6ed0d622d61ecd6edd606e3b564f0a2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac661fca7e7d25e5cd379b811a767c29a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#ac661fca7e7d25e5cd379b811a767c29a">IPADDR_BROADCAST</a>&#160;&#160;&#160;((u32_t)0xffffffffUL)</td></tr>
<tr class="separator:ac661fca7e7d25e5cd379b811a767c29a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a58aee4166c466f9ac7035bf5cc9f9974"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#a58aee4166c466f9ac7035bf5cc9f9974">IP4_ADDR</a>(ipaddr,  a,  b,  c,  d)&#160;&#160;&#160;(ipaddr)-&gt;addr = PP_HTONL(<a class="el" href="def_8h.html#acf56d3da92a0a7a8a62a617e793e948c">LWIP_MAKEU32</a>(a,b,c,d))</td></tr>
<tr class="separator:a58aee4166c466f9ac7035bf5cc9f9974"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2f4e9c339e897e6ca5cb4a2f1e8394d5"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#a2f4e9c339e897e6ca5cb4a2f1e8394d5">ip4_addr_copy</a>(dest,  src)&#160;&#160;&#160;((dest).addr = (src).addr)</td></tr>
<tr class="separator:a2f4e9c339e897e6ca5cb4a2f1e8394d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a33a17a8d2025ce3715db835534868e88"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#a33a17a8d2025ce3715db835534868e88">ip4_addr_set</a>(dest,  src)</td></tr>
<tr class="separator:a33a17a8d2025ce3715db835534868e88"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a973b6ad98e037fc45f1e11d29cda99ea"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#a973b6ad98e037fc45f1e11d29cda99ea">ip4_addr_set_zero</a>(ipaddr)&#160;&#160;&#160;((ipaddr)-&gt;addr = 0)</td></tr>
<tr class="separator:a973b6ad98e037fc45f1e11d29cda99ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afaaed3762ce8e9de14fcf73b19964567"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#afaaed3762ce8e9de14fcf73b19964567">ip4_addr_set_any</a>(ipaddr)&#160;&#160;&#160;((ipaddr)-&gt;addr = <a class="el" href="ip4__addr_8h.html#ad6ed0d622d61ecd6edd606e3b564f0a2">IPADDR_ANY</a>)</td></tr>
<tr class="separator:afaaed3762ce8e9de14fcf73b19964567"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5c7eae50a387987a7f56c29c74255c3c"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#a5c7eae50a387987a7f56c29c74255c3c">ip4_addr_set_loopback</a>(ipaddr)&#160;&#160;&#160;((ipaddr)-&gt;addr = PP_HTONL(<a class="el" href="ip4__addr_8h.html#a6f51a2eb21547df4e6b3ba046188345e">IPADDR_LOOPBACK</a>))</td></tr>
<tr class="separator:a5c7eae50a387987a7f56c29c74255c3c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a46dabb4df212d156004fa5afe03e2051"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#a46dabb4df212d156004fa5afe03e2051">ip4_addr_isloopback</a>(ipaddr)&#160;&#160;&#160;(((ipaddr)-&gt;addr &amp; PP_HTONL(IP_CLASSA_NET)) == PP_HTONL(((u32_t)IP_LOOPBACKNET) &lt;&lt; 24))</td></tr>
<tr class="separator:a46dabb4df212d156004fa5afe03e2051"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a901850ec90b01b9bf6baf69561aa465a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#a901850ec90b01b9bf6baf69561aa465a">ip4_addr_set_hton</a>(dest,  src)</td></tr>
<tr class="separator:a901850ec90b01b9bf6baf69561aa465a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeb39f58b38435f89219c8ccb509eb520"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#aeb39f58b38435f89219c8ccb509eb520">ip4_addr_set_u32</a>(dest_ipaddr,  src_u32)&#160;&#160;&#160;((dest_ipaddr)-&gt;addr = (src_u32))</td></tr>
<tr class="separator:aeb39f58b38435f89219c8ccb509eb520"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad50d93464bbbda199b585c54869a3a4b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#ad50d93464bbbda199b585c54869a3a4b">ip4_addr_get_u32</a>(src_ipaddr)&#160;&#160;&#160;((src_ipaddr)-&gt;addr)</td></tr>
<tr class="separator:ad50d93464bbbda199b585c54869a3a4b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a81658cb05ba504d13ee860e82dc444e9"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#a81658cb05ba504d13ee860e82dc444e9">ip4_addr_get_network</a>(target,  host,  netmask)&#160;&#160;&#160;do { ((target)-&gt;addr = ((host)-&gt;addr) &amp; ((netmask)-&gt;addr)); } while(0)</td></tr>
<tr class="separator:a81658cb05ba504d13ee860e82dc444e9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afd43f6ceb2df8d50c84509ad1059f514"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#afd43f6ceb2df8d50c84509ad1059f514">ip4_addr_netcmp</a>(addr1,  addr2,  mask)</td></tr>
<tr class="separator:afd43f6ceb2df8d50c84509ad1059f514"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2b2230516e7911dfacc9b87644ba30f1"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#a2b2230516e7911dfacc9b87644ba30f1">ip_ntoa</a>(ipaddr)&#160;&#160;&#160;<a class="el" href="group__ipaddr.html#gace12d28aef35bb15962e8563aea571b1">ipaddr_ntoa</a>(ipaddr)</td></tr>
<tr class="separator:a2b2230516e7911dfacc9b87644ba30f1"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a3d3b45daffbc15d65da236e31e621b7e"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structip4__addr.html">ip4_addr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#a3d3b45daffbc15d65da236e31e621b7e">ip4_addr_t</a></td></tr>
<tr class="separator:a3d3b45daffbc15d65da236e31e621b7e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ab3cd7e7fba28c29d35f3c17461071421"><td class="memItemLeft" align="right" valign="top">u8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#ab3cd7e7fba28c29d35f3c17461071421">ip4_addr_isbroadcast_u32</a> (u32_t addr, const struct <a class="el" href="structnetif.html">netif</a> *<a class="el" href="structnetif.html">netif</a>)</td></tr>
<tr class="separator:ab3cd7e7fba28c29d35f3c17461071421"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab5810d404b0ad1b89ef1323ea1e78071"><td class="memItemLeft" align="right" valign="top">u8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#ab5810d404b0ad1b89ef1323ea1e78071">ip4_addr_netmask_valid</a> (u32_t netmask)</td></tr>
<tr class="separator:ab5810d404b0ad1b89ef1323ea1e78071"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2c05f9138da41115978409e547df9670"><td class="memItemLeft" align="right" valign="top">u32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#a2c05f9138da41115978409e547df9670">ipaddr_addr</a> (const char *cp)</td></tr>
<tr class="separator:a2c05f9138da41115978409e547df9670"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af66de98501e92c66714d58119b6d9e1a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#af66de98501e92c66714d58119b6d9e1a">ip4addr_aton</a> (const char *cp, <a class="el" href="ip4__addr_8h.html#a3d3b45daffbc15d65da236e31e621b7e">ip4_addr_t</a> *addr)</td></tr>
<tr class="separator:af66de98501e92c66714d58119b6d9e1a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a28620fdd443c5c98d15e5890cbd9059c"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#a28620fdd443c5c98d15e5890cbd9059c">ip4addr_ntoa</a> (const <a class="el" href="ip4__addr_8h.html#a3d3b45daffbc15d65da236e31e621b7e">ip4_addr_t</a> *addr)</td></tr>
<tr class="separator:a28620fdd443c5c98d15e5890cbd9059c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3825d5b4786c207af971ceb287f101fd"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8h.html#a3825d5b4786c207af971ceb287f101fd">ip4addr_ntoa_r</a> (const <a class="el" href="ip4__addr_8h.html#a3d3b45daffbc15d65da236e31e621b7e">ip4_addr_t</a> *addr, char *buf, int buflen)</td></tr>
<tr class="separator:a3825d5b4786c207af971ceb287f101fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>IPv4 address API </p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a58aee4166c466f9ac7035bf5cc9f9974"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a58aee4166c466f9ac7035bf5cc9f9974">&#9670;&nbsp;</a></span>IP4_ADDR</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define IP4_ADDR</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">ipaddr, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">a, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">b, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">c, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">d&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;(ipaddr)-&gt;addr = PP_HTONL(<a class="el" href="def_8h.html#acf56d3da92a0a7a8a62a617e793e948c">LWIP_MAKEU32</a>(a,b,c,d))</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Set an IP address given by the four byte-parts </p>

</div>
</div>
<a id="a2f4e9c339e897e6ca5cb4a2f1e8394d5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2f4e9c339e897e6ca5cb4a2f1e8394d5">&#9670;&nbsp;</a></span>ip4_addr_copy</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ip4_addr_copy</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">dest, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">src&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;((dest).addr = (src).addr)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Copy IP address - faster than ip4_addr_set: no NULL check </p>

</div>
</div>
<a id="a81658cb05ba504d13ee860e82dc444e9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a81658cb05ba504d13ee860e82dc444e9">&#9670;&nbsp;</a></span>ip4_addr_get_network</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ip4_addr_get_network</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">target, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">host, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">netmask&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;do { ((target)-&gt;addr = ((host)-&gt;addr) &amp; ((netmask)-&gt;addr)); } while(0)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Get the network address by combining host address with netmask </p>

</div>
</div>
<a id="ad50d93464bbbda199b585c54869a3a4b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad50d93464bbbda199b585c54869a3a4b">&#9670;&nbsp;</a></span>ip4_addr_get_u32</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ip4_addr_get_u32</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">src_ipaddr</td><td>)</td>
          <td>&#160;&#160;&#160;((src_ipaddr)-&gt;addr)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>IPv4 only: get the IP address as an u32_t </p>

</div>
</div>
<a id="a46dabb4df212d156004fa5afe03e2051"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a46dabb4df212d156004fa5afe03e2051">&#9670;&nbsp;</a></span>ip4_addr_isloopback</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ip4_addr_isloopback</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">ipaddr</td><td>)</td>
          <td>&#160;&#160;&#160;(((ipaddr)-&gt;addr &amp; PP_HTONL(IP_CLASSA_NET)) == PP_HTONL(((u32_t)IP_LOOPBACKNET) &lt;&lt; 24))</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Check if an address is in the loopback region </p>

</div>
</div>
<a id="afd43f6ceb2df8d50c84509ad1059f514"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afd43f6ceb2df8d50c84509ad1059f514">&#9670;&nbsp;</a></span>ip4_addr_netcmp</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ip4_addr_netcmp</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">addr1, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">addr2, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">mask&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">(((addr1)-&gt;addr &amp; \</div><div class="line">                                              (mask)-&gt;addr) == \</div><div class="line">                                             ((addr2)-&gt;addr &amp; \</div><div class="line">                                              (mask)-&gt;addr))</div></div><!-- fragment --><p>Determine if two address are on the same network.</p>
<ul>
<li>addr1 IP address 1 </li>
<li>addr2 IP address 2 </li>
<li>mask network identifier mask <dl class="section return"><dt>Returns</dt><dd>!0 if the network identifiers of both address match </dd></dl>
</li>
</ul>

</div>
</div>
<a id="a33a17a8d2025ce3715db835534868e88"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a33a17a8d2025ce3715db835534868e88">&#9670;&nbsp;</a></span>ip4_addr_set</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ip4_addr_set</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">dest, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">src&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">((dest)-&gt;addr = \</div><div class="line">                                    ((src) == NULL ? 0 : \</div><div class="line">                                    (src)-&gt;addr))</div></div><!-- fragment --><p>Safely copy one IP address to another (src may be NULL) </p>

</div>
</div>
<a id="afaaed3762ce8e9de14fcf73b19964567"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afaaed3762ce8e9de14fcf73b19964567">&#9670;&nbsp;</a></span>ip4_addr_set_any</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ip4_addr_set_any</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">ipaddr</td><td>)</td>
          <td>&#160;&#160;&#160;((ipaddr)-&gt;addr = <a class="el" href="ip4__addr_8h.html#ad6ed0d622d61ecd6edd606e3b564f0a2">IPADDR_ANY</a>)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Set address to IPADDR_ANY (no need for <a class="el" href="def_8c.html#a14f94347a5b9b9e3602705b75b7ae524">lwip_htonl()</a>) </p>

</div>
</div>
<a id="a901850ec90b01b9bf6baf69561aa465a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a901850ec90b01b9bf6baf69561aa465a">&#9670;&nbsp;</a></span>ip4_addr_set_hton</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ip4_addr_set_hton</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">dest, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">src&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">((dest)-&gt;addr = \</div><div class="line">                               ((src) == NULL ? 0:\</div><div class="line">                               lwip_htonl((src)-&gt;addr)))</div></div><!-- fragment --><p>Safely copy one IP address to another and change byte order from host- to network-order. </p>

</div>
</div>
<a id="a5c7eae50a387987a7f56c29c74255c3c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5c7eae50a387987a7f56c29c74255c3c">&#9670;&nbsp;</a></span>ip4_addr_set_loopback</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ip4_addr_set_loopback</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">ipaddr</td><td>)</td>
          <td>&#160;&#160;&#160;((ipaddr)-&gt;addr = PP_HTONL(<a class="el" href="ip4__addr_8h.html#a6f51a2eb21547df4e6b3ba046188345e">IPADDR_LOOPBACK</a>))</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Set address to loopback address </p>

</div>
</div>
<a id="aeb39f58b38435f89219c8ccb509eb520"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aeb39f58b38435f89219c8ccb509eb520">&#9670;&nbsp;</a></span>ip4_addr_set_u32</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ip4_addr_set_u32</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">dest_ipaddr, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">src_u32&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;((dest_ipaddr)-&gt;addr = (src_u32))</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>IPv4 only: set the IP address given as an u32_t </p>

</div>
</div>
<a id="a973b6ad98e037fc45f1e11d29cda99ea"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a973b6ad98e037fc45f1e11d29cda99ea">&#9670;&nbsp;</a></span>ip4_addr_set_zero</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ip4_addr_set_zero</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">ipaddr</td><td>)</td>
          <td>&#160;&#160;&#160;((ipaddr)-&gt;addr = 0)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Set complete address to zero </p>

</div>
</div>
<a id="a2b2230516e7911dfacc9b87644ba30f1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2b2230516e7911dfacc9b87644ba30f1">&#9670;&nbsp;</a></span>ip_ntoa</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ip_ntoa</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">ipaddr</td><td>)</td>
          <td>&#160;&#160;&#160;<a class="el" href="group__ipaddr.html#gace12d28aef35bb15962e8563aea571b1">ipaddr_ntoa</a>(ipaddr)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>For backwards compatibility </p>

</div>
</div>
<a id="ad6ed0d622d61ecd6edd606e3b564f0a2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad6ed0d622d61ecd6edd606e3b564f0a2">&#9670;&nbsp;</a></span>IPADDR_ANY</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define IPADDR_ANY&#160;&#160;&#160;((u32_t)0x00000000UL)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>0.0.0.0 </p>

</div>
</div>
<a id="ac661fca7e7d25e5cd379b811a767c29a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac661fca7e7d25e5cd379b811a767c29a">&#9670;&nbsp;</a></span>IPADDR_BROADCAST</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define IPADDR_BROADCAST&#160;&#160;&#160;((u32_t)0xffffffffUL)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>255.255.255.255 </p>

</div>
</div>
<a id="a6f51a2eb21547df4e6b3ba046188345e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6f51a2eb21547df4e6b3ba046188345e">&#9670;&nbsp;</a></span>IPADDR_LOOPBACK</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define IPADDR_LOOPBACK&#160;&#160;&#160;((u32_t)0x7f000001UL)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>127.0.0.1 </p>

</div>
</div>
<a id="abc4b2e3531c4992f2ae4b8c0f9751544"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abc4b2e3531c4992f2ae4b8c0f9751544">&#9670;&nbsp;</a></span>IPADDR_NONE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define IPADDR_NONE&#160;&#160;&#160;((u32_t)0xffffffffUL)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>255.255.255.255 </p>

</div>
</div>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="a3d3b45daffbc15d65da236e31e621b7e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3d3b45daffbc15d65da236e31e621b7e">&#9670;&nbsp;</a></span>ip4_addr_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="structip4__addr.html">ip4_addr</a> <a class="el" href="ip4__addr_8h.html#a3d3b45daffbc15d65da236e31e621b7e">ip4_addr_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>ip4_addr_t uses a struct for convenience only, so that the same defines can operate both on ip4_addr_t as well as on ip4_addr_p_t. </p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ab3cd7e7fba28c29d35f3c17461071421"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab3cd7e7fba28c29d35f3c17461071421">&#9670;&nbsp;</a></span>ip4_addr_isbroadcast_u32()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u8_t ip4_addr_isbroadcast_u32 </td>
          <td>(</td>
          <td class="paramtype">u32_t&#160;</td>
          <td class="paramname"><em>addr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const struct <a class="el" href="structnetif.html">netif</a> *&#160;</td>
          <td class="paramname"><em>netif</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Determine if an address is a broadcast address on a network interface</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">addr</td><td>address to be checked </td></tr>
    <tr><td class="paramname">netif</td><td>the network interface against which the address is checked </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>returns non-zero if the address is a broadcast address </dd></dl>

</div>
</div>
<a id="ab5810d404b0ad1b89ef1323ea1e78071"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab5810d404b0ad1b89ef1323ea1e78071">&#9670;&nbsp;</a></span>ip4_addr_netmask_valid()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u8_t ip4_addr_netmask_valid </td>
          <td>(</td>
          <td class="paramtype">u32_t&#160;</td>
          <td class="paramname"><em>netmask</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Checks if a netmask is valid (starting with ones, then only zeros)</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">netmask</td><td>the IPv4 netmask to check (in network byte order!) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>1 if the netmask is valid, 0 if it is not </dd></dl>

</div>
</div>
<a id="af66de98501e92c66714d58119b6d9e1a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af66de98501e92c66714d58119b6d9e1a">&#9670;&nbsp;</a></span>ip4addr_aton()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ip4addr_aton </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>cp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="ip4__addr_8h.html#a3d3b45daffbc15d65da236e31e621b7e">ip4_addr_t</a> *&#160;</td>
          <td class="paramname"><em>addr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Check whether "cp" is a valid ascii representation of an Internet address and convert to a binary address. Returns 1 if the address is valid, 0 if not. This replaces inet_addr, the return value from which cannot distinguish between failure and a local broadcast address.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">cp</td><td>IP address in ascii representation (e.g. "127.0.0.1") </td></tr>
    <tr><td class="paramname">addr</td><td>pointer to which to save the ip address in network order </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>1 if cp could be converted to addr, 0 on failure </dd></dl>

</div>
</div>
<a id="a28620fdd443c5c98d15e5890cbd9059c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a28620fdd443c5c98d15e5890cbd9059c">&#9670;&nbsp;</a></span>ip4addr_ntoa()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char* ip4addr_ntoa </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="ip4__addr_8h.html#a3d3b45daffbc15d65da236e31e621b7e">ip4_addr_t</a> *&#160;</td>
          <td class="paramname"><em>addr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>returns ptr to static buffer; not reentrant!</p>
<p>Convert numeric IP address into decimal dotted ASCII representation. returns ptr to static buffer; not reentrant!</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">addr</td><td>ip address in network order to convert </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>pointer to a global static (!) buffer that holds the ASCII representation of addr </dd></dl>

</div>
</div>
<a id="a3825d5b4786c207af971ceb287f101fd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3825d5b4786c207af971ceb287f101fd">&#9670;&nbsp;</a></span>ip4addr_ntoa_r()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char* ip4addr_ntoa_r </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="ip4__addr_8h.html#a3d3b45daffbc15d65da236e31e621b7e">ip4_addr_t</a> *&#160;</td>
          <td class="paramname"><em>addr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>buflen</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Same as ip4addr_ntoa, but reentrant since a user-supplied buffer is used.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">addr</td><td>ip address in network order to convert </td></tr>
    <tr><td class="paramname">buf</td><td>target buffer where the string is stored </td></tr>
    <tr><td class="paramname">buflen</td><td>length of buf </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>either pointer to buf which now holds the ASCII representation of addr or NULL if buf was too small </dd></dl>

</div>
</div>
<a id="a2c05f9138da41115978409e547df9670"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2c05f9138da41115978409e547df9670">&#9670;&nbsp;</a></span>ipaddr_addr()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32_t ipaddr_addr </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>cp</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Ascii internet address interpretation routine. The value returned is in network order.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">cp</td><td>IP address in ascii representation (e.g. "127.0.0.1") </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ip address in network order </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_b0856f6b0d80ccb263b2f415c91f9e17.html">include</a></li><li class="navelem"><a class="el" href="dir_4e6b3cf33a61b6caac9c8ac30c866f37.html">lwip</a></li><li class="navelem"><a class="el" href="ip4__addr_8h.html">ip4_addr.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
